function addTestDataToFolder( testDatas ){
	var process		= conn.getActiveProcess();
	var inputMap 	= process.getProcessInputMap();
	//var project 	= inputMap.get("project");

	if( testDatas != null && testDatas.length > 0 ){
		//var importedMatTests = conn.createDbObjectList(testDatas);
		
	
		var testDataFolder = conn.lookupObject("ObjectType","[name=='TestDataFolder']");
		for( var i = 0 ; i < testDatas.length ; i++ ){
			var testData = testDatas[ i ];
			//添加EDSTestData
			if( testData.getObjectType() != "NIOTestData" && testData.getObjectType() != "EDSTestData"  ){
				continue;
			}


			valiate( testData );
			var resSet = testData.retrieveData( "materialTradeName,generates:NIOMaterial[0]" );
			var materialTradeName = resSet.getValue(0).getString();
			//if( org.apache.commons.lang.StringUtils.isBlank( materialTradeName ) ){
			//	conn.fail( "Material trade name can't be empty!" );
			//} 
			
			var materialObj = resSet.getValue(1).getDbObject();
			var matName     = materialObj.evaluate("name").getString();
			var folderLabel = matName + ":" + materialTradeName;
			
			var ofobj  = null;
			var oflist = conn.search( "TestDataFolder" , "[label=='"+folderLabel+"']" ) ;
			if( oflist.size() > 0 ){
				ofobj = oflist.get( 0 );
			}else{
			   // Create Folder 
				var folderEditor = conn.createEditor( "TestDataFolder" );
				folderEditor.setString("name", materialTradeName );
				//folderEditor.setString("description", "" );
				folderEditor.setDbObject("parent", materialObj );
				folderEditor.setString("label", folderLabel );
				ofobj = conn.createDbObject(folderEditor, false);
				releaseData( ofobj );
			}
print("--------->>" + ofobj );
			//Add To Folder
			var uniqueId = testData.evaluate( "uniqueId" ).getString();
			var folderItemName = folderLabel + ":" + uniqueId ;
			var simMgrDbObjectEditor = conn.createEditor("ObjectFolderItem");
			simMgrDbObjectEditor.setString("name" , folderItemName );
			simMgrDbObjectEditor.setDbObject("object", testData );
			simMgrDbObjectEditor.setDbObject("folder", ofobj );
			var simMgrDbObjectList = ofobj.evaluate("folderItems").getDbObjectList();
			var bl = false;
			for (var j = 0; j < simMgrDbObjectList.size(); ++j) {
				var simMgrDbObject4 = simMgrDbObjectList.get(j);
				var simMgrDbObject5 = simMgrDbObject4.evaluate("object").getDbObject();
				var uid01 = simMgrDbObject5.evaluate("uniqueId").getString();
				var uid02 = testData.evaluate("uniqueId").getString();
				if ( uid01 == uid02 ){
					conn.editObject(simMgrDbObjectEditor, simMgrDbObject4);
					bl = true;
				}
			}
			if( !bl ){ 
				conn.createDbObject(simMgrDbObjectEditor, false);
			}
		}
	}
}
 
function valiate( testData ){
	var resSet = testData.retrieveData( "materialGroup,materialSubgroup,materialCategory,materialSymbol,materialTradeName,generates:NIOMaterial[0]" );
	var materialGroup = resSet.getValue(0).getString();  
	var materialSubgroup = resSet.getValue(1).getString();
	var materialCategory = resSet.getValue(2).getString();
	var materialSymbol = resSet.getValue(3).getString();
	var materialTradeName = resSet.getValue(4).getString();
	
	var materialObj = resSet.getValue(5).getDbObject();
	var resSet2 = materialObj.retrieveData( "materialGroup,materialSubgroup,materialCategory,materialSymbol" );
	var materialGroup2 = resSet2.getValue(0).getString();  
	var materialSubgroup2 = resSet2.getValue(1).getString();
	var materialCategory2 = resSet2.getValue(2).getString();
	var materialSymbol2 = resSet2.getValue(3).getString();
	
	if( materialGroup != materialGroup2 ){
		conn.fail( "Material group [ " + materialGroup + " ] mismatch !" );
	}
	
	if( materialSubgroup != materialSubgroup2 ){
		conn.fail( "Material subgroup [ " + materialSubgroup + " ] mismatch !" );	
	}
		
	if( materialCategory != materialCategory2 ){
		conn.fail( "Material category [ " + materialCategory + " ] mismatch !" );
	}
	
	if( materialSymbol != materialSymbol2 ){
		conn.fail( "Material symbol [ " + materialSymbol + " ] mismatch !" );
	}
	
	if( org.apache.commons.lang.StringUtils.isBlank( materialTradeName ) ){
		conn.fail( "Material trade name can't be empty!" );
	} 
}

function releaseData( simMgrDbObject ){
	var dataSourceArray = new Array();
	dataSourceArray.push( simMgrDbObject );
	var simMgrDbObjectList = conn.createDbObjectList( dataSourceArray  );
	var simMgrArg = conn.createArgs();
	simMgrArg.setLong( "TargetRL" , 2 );
	conn.executeLifecycleActionV2(simMgrDbObjectList, "setReleaseLevel", "Default", simMgrArg );
}
